package command {
	import business.ProductDelegate;

	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;

	import event.ProductEvent;

	import model.ProductModel;

	import mx.rpc.IResponder;

	public class DelProductCommand implements ICommand, IResponder {
		private var productModel:ProductModel=ProductModel.getInstance();

		public function DelProductCommand() {
		}

		public function execute(e:CairngormEvent):void {
			var delegate:ProductDelegate=new ProductDelegate(this);
			delegate.delProduct((e as ProductEvent).index);
		}

		public function result(data:Object):void {
			if (data) {
				productModel.ac.removeItemAt(data as int);
			}
		}

		public function fault(info:Object):void {
			trace(info);
		}

	}
}